import moment from 'moment';
// 命名规范：Arr普通枚举  field下拉字段枚举  Map表格字段枚举

// 表头筛选字段
const headerForm = {};
// 表格字段
const tableColumn = {
  // 得分标签表格
  addLabelTableMap: [
    { prop: 'id', label: 'ID', type: 'text' },
    { prop: 'title', label: '标签名称', type: 'text', tooltip: true },
    { prop: 'levelStr', label: '层级', type: 'text' },
    { prop: 'manRatio', label: '男系数', type: 'text' },
    { prop: 'womanRatio', label: '女系数', type: 'text' },
    { prop: 'maxValue', label: '最大值', type: 'text' },
    { prop: 'countRulesStr', label: '计算规则', type: 'text' },
    { prop: 'isRadarStr', label: '雷达显示', type: 'text' },
    { prop: 'statusStr', label: '状态', type: 'text' },
    { prop: 'createTime', label: '创建时间', type: 'text', width: 160 },
    { prop: 'updateTime', label: '更新时间', type: 'text', width: 160 },
  ],
};
// 表单字段
const editForm = {
  // 得分标签筛选表单
  addLabelFilterMap: [
    { prop: 'level', label: '层级', type: 'inputNumber', col: 0 },
    { prop: 'manRatio', label: '男系数', type: 'inputNumber', col: 0 },
    { prop: 'womanRatio', label: '女系数', type: 'inputNumber', col: 0 },
    { prop: 'maxValue', label: '最大值', type: 'inputNumber', col: 0 },
    { prop: 'countRules', label: '计算规则', type: 'input', optionKey: 'COUNT_RULES', col: 0 },
    { prop: 'isRadar', label: '雷达显示', type: 'select', optionKey: 'RADAR_STATUS', col: 0 },
    { prop: 'status', label: '状态', type: 'select', optionKey: 'COVERT_STATUS', col: 0 },
    {
      prop: 'createTime',
      label: '创建时间',
      type: 'datePicker',
      dateType: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd',
      pickerOptions: {
        disabledDate: function (time) {
          return time.getTime() > moment().format('x');
        },
      },
      clearable: true,
      col: 0,
    },
    {
      prop: 'updateTime',
      label: '更新时间',
      type: 'datePicker',
      dateType: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd',
      pickerOptions: {
        disabledDate: function (time) {
          return time.getTime() > moment().format('x');
        },
      },
      clearable: true,
      col: 0,
    },
  ],
  // 得分标签新增信息表单
  addLabelFormMap: [
    {
      prop: 'title',
      type: 'input',
      label: '标签名称',
      col: 24,
    },
    {
      prop: 'level',
      type: 'select',
      label: '标签层级',
      optionKey: 'LEVEL_STATUS',
      col: 24,
    },
    {
      prop: 'manRatio',
      type: 'inputNumber',
      label: '男系数',
      col: 24,
    },
    {
      prop: 'womanRatio',
      type: 'inputNumber',
      label: '女系数',
      col: 24,
    },
    {
      prop: 'maxValue',
      type: 'inputNumber',
      label: '最大值',
      col: 24,
    },
    {
      prop: 'countRules',
      type: 'select',
      label: '计算规则',
      optionKey: 'COUNT_RULES',
      col: 24,
    },
    {
      prop: 'isRadar',
      type: 'select',
      label: '雷达显示',
      optionKey: 'RADAR_STATUS',
      col: 24,
    },
    {
      prop: 'status',
      type: 'radio',
      label: '状态',
      optionKey: 'COVERT_STATUS',
      customClass: 'genderItem',
      col: 24,
    },
  ],
};
// 其他映射
const otherMap = {};
// 表单字段校验
const editRule = {
  addLabelFormRule: {
    level: [{ required: true, message: '请选择标签层级', trigger: 'change' }],
    title: [{ required: true, message: '标签名称不能为空', trigger: 'blur' }],
    maxValue: [{ required: true, message: '最大值不能为空', trigger: 'blur' }],
    countRules: [{ required: true, message: '请选择计算规则', trigger: 'change' }],
    isRadar: [{ required: true, message: '请选择雷达显示', trigger: 'change' }],
    status: [{ required: true, message: '请选择状态', trigger: 'change' }],
    manRatio: [{ required: true, message: '男系数不能为空', trigger: 'blur' }],
    womanRatio: [{ required: true, message: '女系数不能为空', trigger: 'blur' }],
  },
};
export default {
  headerForm,
  tableColumn,
  editForm,
  otherMap,
  editRule,
};
